package com.ln.cmsln.controller.hu;


import com.alibaba.fastjson.JSON;
import com.ln.cmsln.pojo.entity.hu.CompanyProfile;
import com.ln.cmsln.pojo.entity.hu.Curriculum;
import com.ln.cmsln.pojo.entity.hu.Teacher;
import com.ln.cmsln.service.hu.CompanyProfileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Helen
 * @since 2022-03-31
 */
@RestController
@CrossOrigin
@Api(tags = "企业简介")
@RequestMapping("/api/companyProfile")
public class CompanyProfileController {


    @Resource
    private CompanyProfileService companyProfileService;


    @RequestMapping("getAll")
    public String getAll(){
        List<CompanyProfile> list = companyProfileService.list();
        Map<String, Object> map = new HashMap<>();
        map.put("code", 0);
        map.put("count", 0);
        map.put("data", list);
        String json= JSON.toJSONString(map);
        return json;
    }

    @RequestMapping("/del")
    public boolean del(int cId){
        boolean b = companyProfileService.removeById(cId);
        return b;
    }


    @PostMapping("/save")
    public boolean save(CompanyProfile companyProfile){
        return   companyProfileService.save(companyProfile);
    }

}

